<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="用户管理" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addData()" ng-disabled="!btnPermission.userAdd"
                        translate translate-attr-title="{{!btnPermission.userAdd?'无权限执行此操作':''}}">新增</button>
                    <button class="btn btn-operate" ng-click="delData('batch')" ng-disabled="!btnPermission.userDel"
                        translate translate-attr-title="{{!btnPermission.userDel?'无权限执行此操作':''}}">删除</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" translate
                            translate-attr-title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" translate translate-attr-title="配置表格列"
                            ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                        <div class="btn btn-default base-color">
                            <div translate translate-attr-title="导出">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                            <ul class="more-tool">
                                <li yb-download download-url="exportParam.sectionUrl"
                                    download-param="exportParam.sectionParam" download-key="userids">
                                    <i class="yb-icon ico-export-o"></i> <span translate>导出</span>
                                </li>
                                <li yb-download download-url="exportParam.allUrl" download-param="condition"
                                    download-duration="3">
                                    <i class="yb-icon ico-export-o"></i> <span translate>导出全部</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')"
                        translate-attr-title="高级搜索" translate="高级搜索more"></button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" translate translate-attr-placeholder="用户名"
                            ng-model="condition.name">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)" translate>搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)"
                reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label"><span translate>用户名</span>：</label>
                        <input type="text" name="name" class="form-control col-xs-8" ng-model="condition.name">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label"><span translate>手机号</span>：</label>
                        <input type="text" name="mobile" class="form-control" ng-model="condition.mobile">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label"><span translate>状态</span>：</label>
                        <select class="form-control" ng-model="condition.locked"
                            ng-options="item.id as item.name for item in userStatues">
                            <option value="" translate>请选择</option>
                        </select>
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tableConfig" col-fixed="true"
                has-check-col="true" set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th width="40" class="text-center th-check border-l-none">
                                        <div yb-check-box yb-checked="markInfo.allChecked" yb-click="selectAll()"></div>
                                    </th>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-click="toSort(tableConfig.tableCol, $index)"
                                        ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.fixedWidth"
                                            fixed-width="tbStyle.scrollLeft"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-click="toSort(tableConfig.tableCol, $index)"
                                        ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.cueRow}"
                                    ng-click="selectRow($index)">
                                    <td width="40" class="text-center border-l-none">
                                        <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item)">
                                        </div>
                                    </td>
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)"
                                            ng-if="!!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button class="btn btn-operate m-r-xs" ng-click="restPwd(item)"
                                                ng-disabled="!btnPermission.userResetPwd" translate
                                                translate-attr-title="{{!btnPermission.userResetPwd?'无权限执行此操作':''}}">重置密码</button>
                                            <button class="btn btn-operate m-r-xs"
                                                ng-click="switchLockStatues(item, 'lock')"
                                                ng-disabled="item.locked === 1 || !btnPermission.userPowerSwitch"
                                                translate
                                                translate-attr-title="{{!btnPermission.userPowerSwitch?'无权限执行此操作':''}}">锁定</button>
                                            <button class="btn btn-operate m-r-xs"
                                                ng-click="switchLockStatues(item, 'enabled')"
                                                ng-disabled="item.locked === 0 || !btnPermission.userPowerSwitch"
                                                translate
                                                translate-attr-title="{{!btnPermission.userPowerSwitch?'无权限执行此操作':''}}">启用</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                                ng-disabled="!btnPermission.userEdit" translate
                                                translate-attr-title="{{!btnPermission.userEdit?'无权限执行此操作':''}}">编辑</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="delData('single', item)"
                                                ng-disabled="!btnPermission.userDel" translate
                                                translate-attr-title="{{!btnPermission.userDel?'无权限执行此操作':''}}">删除</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.cueRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)"
                                            ng-if="!!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button class="btn btn-operate m-r-xs" ng-click="restPwd(item)"
                                                ng-disabled="!btnPermission.userResetPwd"
                                                title="{{!btnPermission.userResetPwd?'无权限执行此操作':''}}">重置密码</button>
                                            <button class="btn btn-operate m-r-xs"
                                                ng-click="switchLockStatues(item, 'lock')"
                                                ng-disabled="item.locked === 1 || !btnPermission.userPowerSwitch"
                                                title="{{!btnPermission.userPowerSwitch?'无权限执行此操作':''}}">锁定</button>
                                            <button class="btn btn-operate m-r-xs"
                                                ng-click="switchLockStatues(item, 'enabled')"
                                                ng-disabled="item.locked === 0 || !btnPermission.userPowerSwitch"
                                                title="{{!btnPermission.userPowerSwitch?'无权限执行此操作':''}}">启用</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                                ng-disabled="!btnPermission.userEdit"
                                                title="{{!btnPermission.userEdit?'无权限执行此操作':''}}">编辑</button>
                                            <button class="btn btn-operate" ng-click="delData('single', item)"
                                                ng-disabled="!btnPermission.userDel"
                                                title="{{!btnPermission.userDel?'无权限执行此操作':''}}">删除</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0" translate>暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-check-box class="m-t-xs m-r-sm" yb-checked="markInfo.allChecked" yb-check-name="全选"
                    yb-click="selectAll()"></div>
                <button class="btn btn-operate" ng-click="delData('batch')" ng-disabled="!btnPermission.userDel"
                    translate translate-attr-title="{{!btnPermission.userDel?'无权限执行此操作':''}}">删除</button>
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-60">
                <form name="form" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i><span translate>用户账号</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="loginName" class="form-control" ng-model="detailInfo.loginName"
                                required yb-focus ng-disabled="tabFlag.type === 1" maxlength="20">
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.loginName.$dirty || (form.loginName.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.loginName.$error.required && !form.loginName.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i><span translate>用户名</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="realName" class="form-control" ng-model="detailInfo.name" required
                                yb-focus maxlength="20">
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.realName.$dirty || (form.realName.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.realName.$error.required && !form.realName.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><span translate>SAP编码</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="sapCode" class="form-control" ng-model="detailInfo.sapCode"
                                maxlength="20">
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><span translate>昵称</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="nickName" class="form-control" ng-model="detailInfo.nickname"
                                maxlength="20">
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><span translate>性别</span>：</label>
                        <label class="col-xs-5 control-label p-l-n text-left">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.sex" value="1"
                                yb-radio-name="男">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.sex" value="0"
                                yb-radio-name="女">
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i><span translate>所属部门</span>：</label>
                        <div class="col-xs-5 wrapper-none" department-selector ng-model="dataSelected.department"></div>
                        <div class="col-xs-4 msg-block" ng-show="submitted && !dataSelected.department.id">
                            <div class="error-msg">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请选择</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><i>*</i><span translate>用户角色</span>：</label>
                        <div bj-multi-selector class="col-xs-5 wrapper-none dropdown-prop" name="role" is-required="true"
                            ng-model="dataSelected.role" value-list="rolesSource" placeholder="请选择角色"></div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.role.$dirty || (form.role.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.role.$error.required">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请选择</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-none">
                        <label class="col-xs-2 control-label"></label>
                        <label class="col-xs-5 wrapper-none text-left disable-color" translate>角色可多选</label>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><span translate>采购组</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="purchaseGroup" class="form-control" ng-model="detailInfo.purchaseGroup "
                                maxlength="20">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><span translate>联系电话</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="telephone" class="form-control" ng-model="detailInfo.telephone"
                                yb-tel yb-focus maxlength="20">
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.telephone.$dirty || (form.telephone.$invalid&&submitted)">
                            <div class="error-msg" ng-show="form.telephone.$error.tel && !form.telephone.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>电话号码格式错误</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><span translate>手机号</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="mobile" class="form-control" ng-model="detailInfo.mobile" yb-mobile
                                yb-focus maxlength="11">
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.mobile.$dirty || (form.mobile.$invalid&&submitted)">
                            <div class="error-msg" ng-show="form.mobile.$error.mobile && !form.mobile.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>手机号格式错误</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-sm">
                        <label class="col-xs-2 control-label"><span translate>电子邮箱</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="email" class="form-control" ng-model="detailInfo.email" yb-email
                                yb-focus maxlength="50">
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.email.$dirty || (form.email.$invalid && submitted)">
                            <div class="error-msg" ng-show="form.email.$error.email && !form.email.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>邮箱格式错误</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b" ng-if="!!btnPermission.userPowerSwitch">
                        <label class="col-xs-2 control-label"><span translate>是否锁定</span>：</label>
                        <label class="col-xs-5 control-label p-l-n text-left">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.locked" value="1"
                                yb-radio-name="是">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.locked" value="0"
                                yb-radio-name="否">
                        </label>
                    </div>
                    <!-- wangcan:增加是否为服务人员 -->
                    <div class="form-group m-b">
                        <label class="col-xs-2 control-label"><span translate>是否为服务人员</span>：</label>
                        <label class="col-xs-5 control-label p-l-n text-left">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.isService" value="'1'"
                                yb-radio-name="是">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.isService" value="'0'"
                                yb-radio-name="否">
                        </label>
                    </div>
                    <div class="form-group m-t-n-sm m-b-sm" ng-if="tabFlag.type === 0">
                        <label class="col-xs-2 control-label"></label>
                        <label class="col-xs-5 wrapper-none text-left danger-color" translate>
                            注：新建用户初始密码为：yn123
                        </label>
                    </div>
                </form>
            </div>
            <div class="bottom-area btn-bar single-col border-t clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(form.$valid)"
                    translate>保存</button>
                <button type="button" class="btn btn-default" ng-click="changeTab(0)" translate>取消</button>
            </div>
        </div>
    </div>
</div>